<template>
  <div>
    <header class="header">
      <h1>todos</h1>
      <input
        class="new-todo"
        placeholder="请输入任务名称"
        autofocus
        v-model="text"
        @keyup.enter="fn"
      />
    </header>
  </div>
</template>

<script>
export default {
  data () {
    return {
      text: ''
    }
  },
  methods: {
    fn () {
      this.$emit('fn', this.text)
      this.text = ''
    }
  }
}
</script>

<style scoped lang="less"></style>
